#include <iostream>
#include <cstring>
#include <algorithm>

using namespace std;

string s;
int ans;

int main()
{
    cin >> s;
    for (int i = 0; i + 1 < s.size(); i++)
    {
        if (s[i] == s[i + 1] || s[i] == '?' || s[i + 1] == '?')
        {
            i++;
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}